<!--
 * @Author: your name
 * @Date: 2021-03-30 17:47:18
 * @LastEditTime: 2021-04-02 09:51:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \MVVM\index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text" v-model='school.name'>
        <div>{{school.name}}</div>
        <div>{{school.age}}</div>
        <div>{{computedName}}</div>
        <ul>
            <li>1</li>
            <li>1</li>
        </ul>
        <button v-on:click="change">更新操作</button>
        <div v-html= 'message'></div>
    </div>

    <script src="./mvvm.js"></script>

    <!-- vue导入，作为对比使用 -->
    <!-- <script src="./node_modules/vue/dist/vue.js"></script> -->
    <script>
        var vm = new MyVue({
            el: '#app',
            data: {
                school: {
                    name: '张三',
                    age: 18
                },
                message: '<h1>Hello MVVM</h1>',
            },
            watch: {
                name: function (e) {
                    console.log(e);
                }
            },
            methods: {
                change(){
                    this.school.name = '李四'
                }
            },
            computed: {
                computedName(){
                    return this.school.name + ' computed'
                }
            }
        })
    </script>
</body>

</html>